<?xml version="1.0" encoding="UTF-8" ?>
<%@page import="com.lianjing.sh.project.authority.web.controller.login.C_Admin_Login_Access"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html>
<head>
	<jsp:include page="/WEB-INF/jsp/_admin/common/admin_common_head.jsp" />
	<title>ERP元素-首页</title>
	<link rel="stylesheet" href="${RootUrl}/resources/css/login.css" type="text/css" />
	<script type='text/javascript' src='/webjars/bootstrap-validator/js/validator.js'></script>
</head>

<body style="position: relative;">
	<div class="login">
		<div class="message">管理系统登录</div>
		<div id="darkbannerwrap"></div>

		<form class="js_login"
		 com="myUser" access="${RootUrl}<%=C_Admin_Login_Access.Access.Operate().getUrl()%>" class="form-signin" loginAfterTo="/"
		>
			<div class="form-group" 
			 com="myValidate" failAfterAction="@fun:fun_validateFail()" successAfterAction="@fun:fun_validateSuccess()"
			>
			<input name="username" data-toggle="tooltip" 
			 placeholder="用户名" required type="text" autofocus="autofocus" 
			/>
			</div>
			<hr class="hr15">
			
			<div class="form-group"
			 com="myValidate" failAfterAction="@fun:fun_validateFail()" successAfterAction="@fun:fun_validateSuccess()" 
			>
			<input name="password" data-toggle="tooltip" 
			 placeholder="密码" required type="password" 
			/>
			</div>
			<hr class="hr15">
			
			<input value="登录" style="width: 100%;" type="submit"/>
			<hr class="hr20">
				<!-- 帮助 <a onClick="alert('请联系管理员')">忘记密码</a> -->
		</form>
		
		<script>
		/**
		 * 开启tooltip显示验证信息
		 */
		$("[data-toggle='tooltip']")
			.attr("data-placement", "top")
			.tooltip();
		/*
		 * 覆盖bootstrap-validator插件的默认方法
		 */
		var validator = $.fn.validator.Constructor;
		var showErrors = validator.prototype.showErrors = function ($el) {
		    var errors = $el.data('bs.validator.errors')
		    var $group = $el.closest('.form-group')
		    var $tooltip = $group.find("[data-toggle='tooltip']")

		    if (!errors.length) return
		    // tooltip
		    $tooltip.data('bs.validator.originalContent') === undefined && $tooltip.data('bs.validator.originalContent', $tooltip.attr("data-original-title"))
		    $tooltip.attr("data-original-title", errors).tooltip('show');
		}
		var clearErrors = validator.prototype.clearErrors = function ($el) {
		    var $group = $el.closest('.form-group')
		    var $tooltip = $group.find("[data-toggle='tooltip']")
		}
		/*
		 * 提交验证处理
		 */
		$(function(){
			$('.js_login').validator({}).on('submit', function (e) {
				if (e.isDefaultPrevented()) {
					//$(this).fireBind('login');
				} else {
					e.preventDefault();
					$(this).fireBind('login');
				}
			})
		});
		/* 验证失败 */
		function fun_validateFail(){
			var $myValidate = $(this);
			$myValidate
				.data('bs.validator.errors', $myValidate.outputData());
			showErrors($(this));
		}
		/* 验证成功 */
		function fun_validateSuccess(){
			clearErrors($(this));
		}
		</script>
		
	</div>
	<jsp:include page="/WEB-INF/jsp/_admin/common/admin_common_foot.jsp" />
</body>
</html>